package com.example.状态模式;

/**
 * 制作咖啡的类
 */
public class MakeCoffe {

    /**
     * 这杯咖啡的状态
     */
    public State state;

    /**
     * 没有杯子状态
     */
    public NoCupState noCupState;
    /**
     * 有一个空杯子状态
     */
    public EmptyCupState emptyCupState;
    /**
     * 杯子里有速溶咖啡粉状态
     */
    public InstantCoffeCupState instantCoffeCupState;
    /**
     * 冲好咖啡状态
     */
    public CoffeOkState coffeOkState;

    public MakeCoffe() {
        this.noCupState = new NoCupState(this);
        this.emptyCupState = new EmptyCupState(this);
        this.instantCoffeCupState = new InstantCoffeCupState(this);
        this.coffeOkState = new CoffeOkState();

        // 设置默认状态
        this.state = this.noCupState;
    }

    // 拿杯子
    public void takeCup() {
        state.takeCup();
    }

    // 加入速溶咖啡
    public void addInstantCoffe() {
        state.addInstantCoffe();
    }

    // 加水
    public void addWater() {
        state.addWater();
    }

    public void enjoyCoffe() {
        state.enjoyCoffe();
    }
}
